home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / comm / mebbs / listit02.lha / LISTIT / DIZLIST102.lha / AFTERUP.REXX next >
OS/2 REXX Batch file  |  1994-10-05  |  4KB  |  176 lines

  1. /* FILEID.DIZ searcher - original by Keith Townsend & Larry Cloud */
  2. signal on ERROR
  3. parse arg LineNumber
  4. options results
  5. DoorName = "DIZLIST"
  6. author = "Keith Townsend & Larry Cloud"
  7. vers = "1.02"
  8. if( ~show( 'l', "mebbsarexx.library" ) )then do
  9.  if( ~addlib( "mebbsarexx.library", 0, -30, 0 ) )then do
  10.   say "Could not open library"
  11.   exit 10
  12.  end
  13. end
  14.  
  15. /* Open the config File */
  16.  
  17.  call open conf,('MEBBSNET:CONFIGFILES/DIZ.CFG'), 'R'
  18.     descpath = readln(conf)
  19.     tempath = readln(conf)
  20.     diztemp = readln(conf)
  21.  call close conf
  22.  
  23. filepath=tempath||"tmp"||linenumber
  24.  
  25.  
  26. string= ""
  27. call output
  28. string="Please stand by, Checking archive for long description file"
  29. call output
  30. string="This will just take a few seconds..."
  31. call output
  32. call carrier
  33.  
  34. address command "list "filepath" > t:filelist.txt lformat %n"
  35.  
  36. c=0
  37. call open(file,"t:filelist.txt","R")
  38. do until eof(file)
  39.  c=c+1
  40.  filename.c=readln(file)
  41. end
  42.  
  43. call close(file)
  44.  
  45. call carrier
  46.  
  47. do i=1 to c
  48.  
  49.  if upper(right(filename.i,4))=".LHA" then do
  50.   unstring="lha e "
  51.   estring=""
  52.   call doit
  53.  end
  54.  
  55.  if upper(right(filename.i,3))=".LZ" then do
  56.   unstring="lha e "
  57.   estring=""
  58.   call doit
  59.  end
  60.  
  61.  if upper(right(filename.i,4))=".LZH" then do
  62.   unstring="lha e "
  63.   estring=""
  64.   call doit
  65.  end
  66.  
  67.  if upper(right(filename.i,4))=".ZIP" then do
  68.   unstring="unzip -x "
  69.   estring=""
  70.   call doit
  71.  end
  72.  
  73.  if upper(right(filename.i,4))=".ARC" then do
  74.   unstring="arc e "
  75.   estring=""
  76.   call doit
  77.  end
  78.  
  79.  if upper(right(filename.i,4))=".ZOO" then do
  80.   unstring="booz x "
  81.   estring=""
  82.   call doit
  83.  end
  84.  
  85. if upper(right(filename.i,4))=".DMS" then do
  86.   unstring="DMS VIEWDIZ "
  87.   estring=" SAVE"
  88.   call doit
  89.  end
  90.  
  91. end
  92. address command "delete t:filelist.txt"
  93. address command "delete t:DIZLIST.BAT"
  94. address command "delete "||diztemp||Linenumber||"#?.#?"
  95. string="Thank You for using "||Doorname||" version "||vers||" by "||Author
  96. call output
  97. string=""
  98. call output
  99. call Exit_Door DoorName,LineNumber
  100. exit 0
  101.  
  102. ERROR:
  103. address command "delete t:filelist.txt"
  104. address command "delete t:DIZLIST.BAT"
  105. address command "delete "||diztemp||Linenumber||"#?.#?"
  106. string="Thank You for using "||Doorname||" version "||vers||" by "||Author
  107. call output
  108. string=""
  109. call output
  110. call Exit_Door DoorName,LineNumber
  111. exit 0
  112.  
  113. Carrier:
  114. call CDetect doorname,linenumber
  115. cd=upper(result)
  116. if cd="NO CARRIER!" then signal error
  117. return
  118.  
  119. doit:
  120.  
  121. call open Tfile,('T:DIZLIST.BAT'),'W'
  122. call writeln Tfile, "cd "||diztemp
  123. call writeln Tfile, "Copy "||filepath||"/"||filename.i||" to "||diztemp||""||Linenumber||filename.i
  124. call writeln Tfile, "wait 1"
  125. call writeln Tfile, unstring||Linenumber||filename.i||estring||" file_id.diz"
  126. call writeln Tfile, "wait 1"
  127. call writeln Tfile, "rename file_id.diz as "||LineNumber||"file_id.diz"
  128. call writeln Tfile, 'endcli'
  129.  
  130. call close Tfile
  131.  
  132. address command "execute T:DIZLIST.BAT"
  133.  
  134.  
  135. if exists(diztemp||LineNumber||"file_id.diz") then do
  136.  
  137.  string=""
  138.  call output
  139.  string="I found a FILE_ID.DIZ file in "Filename.i""
  140.  call output
  141.  string="and copied it as a Long Description "
  142.  call output
  143.  string=""
  144.  call output
  145.  string="Please select N or hit <ENTER> at  "
  146.  call output
  147.  string="the "Would you like to add a LONG description" prompt, to use the new"
  148.  call output
  149.  string="FILE_ID.DIZ description, or Y to add you own long description"
  150.  call output
  151.  string=""
  152.  call output
  153.  address command "copy "||diztemp||LineNumber||"FILE_ID.DIZ TO "descpath||filename.i||".DESC"
  154.  address command "wait 2"
  155.  address command "delete t:filelist.txt"
  156.  address command "delete t:DIZLIST.BAT"
  157.  address command "delete "||diztemp||Linenumber||"#?.#?"
  158. return
  159. end
  160.  
  161. else do
  162.  string="No FILE_ID.DIZ found in "Filename.i""
  163.  call output
  164.  string="You may enter a long description if you wish."
  165.  call output
  166. address command "delete "||diztemp||Linenumber||"#?.#?"
  167. end
  168. return
  169.  
  170. output:
  171. call message doorname,linenumber,string,1
  172. return
  173.  
  174.  
  175.  
  176.